var t = getApp();

Page({
    data: {
        role: 2,
        name: ""
    },
    bindNameEdit: function(t) {
        this.setData({
            name: t.detail.value
        });
    },
    clickSave: function(e) {
        var a = this.data.name;
        if (0 != a.length) {
            t.network.post({
                url: t.url.editInfo,
                params: {
                    name: a
                },
                before: function() {
                    wx.showLoading({
                        title: "提交数据"
                    });
                },
                success: function(e) {
                    if (wx.hideLoading(), 1 == e.data.result) {
                        t.util.showToast(e.data.message);
                        var a = getCurrentPages();
                        a[a.length - 2].setData({
                            needUpdate: !0
                        }), a[a.length - 3].setData({
                            needUpdate: !0
                        }), setTimeout(function() {
                            wx.navigateBack({});
                        }, 1e3);
                    } else t.util.showToast(e.data.message);
                },
                fail: function() {
                    wx.hideLoading(), t.util.showToast("修改失败");
                },
                complete: function() {}
            });
        } else t.util.showToast("请输入姓名");
    },
    onLoad: function(e) {
        var a = t.globalData.userInfo;
        this.setData({
            name: a.name,
            role: a.role
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {}
});